package com.ttxs.uaa.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ttxs.uaa.entity.SysUserRole;
import com.ttxs.uaa.mapper.SysUserRoleMapper;
import com.ttxs.uaa.service.ISysUserRoleService;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Collection;

/**
 * <p>
 * 用户和角色关联表 服务实现类
 * </p>
 *
 * @author 天天向上
 * @since 2021-07-26
 */
@Service
public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUserRole> implements ISysUserRoleService {

    @Override
    public boolean removeByUserIds(Collection<? extends Serializable> idList) {
        return getBaseMapper().delete(new LambdaQueryWrapper<SysUserRole>()
                .in(SysUserRole::getUserId, idList)) > 0;
    }

    @Override
    public boolean removeByRoleIds(Collection<? extends Serializable> idList) {
        return getBaseMapper().delete(new LambdaQueryWrapper<SysUserRole>()
                .in(SysUserRole::getRoleId, idList)) > 0;
    }
}
